﻿using QDPay.Bus.domain.json;
using QDPay.Bus.domain.WxStore;
using QDPay.Bus.util;
using System;
using System.Collections.Generic;
using System.Text;

namespace QDPay.Bus
{
    public class WxStores : BusinessBase
    {
        private static string _pc_key;

        /// <summary>
        /// 员工登录
        /// </summary>
        /// <param name="name">登录名</param>
        /// <param name="pwd">密码</param>
        /// <returns></returns>
        public JsonBase<WxStoreEmployee> Login(string name, string pwd)
        {
            var key = _pc_key;
            var url = string.Format("{0}/api/WxStore/LoginByPay", ApiConfig.Domain);
            var data = string.Format("storeid=68&loginName={0}&pwd={1}&key={2}", name, pwd, key);
            return RestHttp.Post<JsonBase<WxStoreEmployee>>(url, data);
        }

        public static void InitPcKey()
        {
            if (string.IsNullOrEmpty(_pc_key))
            {
                _pc_key = PC.GetPCInfo();
            }
        }
    }
}
